package com.example.saiaadmin.controller;
import com.example.saiaadmin.dto.DTOEbSystemDept;
import com.example.saiaadmin.entry.EbSystemDept;
import com.example.saiaadmin.service.EbSystemDeptService;
import com.example.saiaadmin.utils.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 部门信息表Controller
 *
 *  @author  Vagrant
 * @since 2025/01/13
 */
@RestController
@RequestMapping("/eb-system-dept")
public class EbSystemDeptController {

    @Autowired
    private EbSystemDeptService service;

    /**
     * 查询所有部门
     * @return
     */
    @GetMapping("/accessDept")
    public ResultData<List> accessDept(){
        DTOEbSystemDept ebSystemDept = new DTOEbSystemDept();
        List<DTOEbSystemDept> list= service.accessDept(ebSystemDept);
        return ResultData.success("查询成功",list);
    }

    /**
     * 查询所有部门
     * @return
     */
    @GetMapping("/index")
    public ResultData<List> index(Integer page,Integer limit,String name){
        DTOEbSystemDept ebSystemDept = new DTOEbSystemDept();
        ebSystemDept.setName(name);
        List<DTOEbSystemDept> list= service.accessDept(ebSystemDept);
        return ResultData.success("success",list);
    }
}
